package com.jili.ocp;

/**
 * ClassName: ShapDemo
 * Package com.jili.ocp
 * Description:
 *
 * @Author: 廖继礼
 * @Create: 2024/7/27
 * @Version: v1.0
 */
public class ShapeDemo {
    public static void main(String[] args) {
        Shape rectangle = new Rectangle();
        Shape square = new Square();
        rectangle.draw();
        square.draw();

    }

}

abstract class Shape {

    abstract void draw();
}

class Rectangle extends Shape {

    @Override
    void draw() {
        System.out.println("画正方形");
    }
}

class Square extends Shape {

    @Override
    void draw() {
        System.out.println("画正方形");
    }
}
